//
//  TLRechargeCoinsCollectionViewCell.m
//  WXReader
//
//  Created by huaya on 2025/3/27.
//  Copyright © 2025 Andrew. All rights reserved.
//

#import "TLRechargeCoinsCollectionViewCell.h"

@interface TLRechargeCoinsCollectionViewCell ()

@property (weak, nonatomic) IBOutlet UIView *lxView;

@property (weak, nonatomic) IBOutlet UILabel *lxLab;
@property (weak, nonatomic) IBOutlet UIView *bgView;
@property (weak, nonatomic) IBOutlet UILabel *oneLab;

@property (weak, nonatomic) IBOutlet UILabel *twoLab;
@property (weak, nonatomic) IBOutlet UILabel *threeLab;

@property (weak, nonatomic) IBOutlet UIView *lineView;


@property (nonatomic, assign) bool isSelected;
@end

@implementation TLRechargeCoinsCollectionViewCell

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
    _isSelected = YES;
    _lxLab.layer.masksToBounds = YES;
    
    self.bgView.layer.cornerRadius = 6;
    self.bgView.layer.borderWidth = 1;
    self.bgView.layer.borderColor = [UIColor colorWithHexString:@"#9E6DFC"].CGColor;
    [self.bgView setBackgroundColor:[UIColor whiteColor]];
    [self.lineView setBackgroundColor:[UIColor colorWithHexString:@"#9E6DFC"]];
    
}
- (void)setModel:(TLRechargeGoodsModel *)model{
    if (model) {
        _model = model;
        
        self.lxLab.text = [NSString stringWithFormat:@" %@ ",model.hint1];
        
        self.oneLab.text = model.goodsName;
        
        self.twoLab.text = model.hint2;
        
        self.threeLab.text = [NSString stringWithFormat:@"$%@",model.price];
        
        if (model.tl_isSelected) {
            self.bgView.layer.borderColor = [UIColor colorWithHexString:@"#FFC636"].CGColor;
            [self.bgView setBackgroundColor:[UIColor colorWithHexString:@"#FFFAEC"]];
            [self.lineView setBackgroundColor:[UIColor colorWithHexString:@"#FFC636"]];
        }else{
            self.bgView.layer.borderColor = [UIColor colorWithHexString:@"#C8C8C8"].CGColor;
            [self.bgView setBackgroundColor:[UIColor whiteColor]];
            [self.lineView setBackgroundColor:[UIColor colorWithHexString:@"#EEEEEE"]];
        }
        
        [self.contentView layoutIfNeeded];
        
        [_lxLab addRoundingCornersWithRoundingCorners:UIRectCornerTopLeft|UIRectCornerBottomRight andCornerRadii:8];
        
    }
}
@end
